

import os
from openai import OpenAI #openai 的版本是1.43.0

os.environ["ARK_API_KEY"] = '' #你的ARK API Key
os.environ["BASE_URL"] = 'https://ark.cn-beijing.volces.com/api/v3' #OpenAI 的 API URL
os.environ["LLM_MODELEND"] = 'ep-20241104131149-csxf9' #你的模型ID


client = OpenAI(
     api_key = os.environ.get("ARK_API_KEY"),
    base_url = os.environ.get("BASE_URL"),
)

response = client.chat.completions.create(
    model=os.environ.get("LLM_MODELEND"),
    messages=[
        {"role": "system", "content": "You are a creative AI."},
        {"role": "user", "content": "请给我的花店起个名"},
    ],
    temperature=0.8,
    max_tokens=600,
)

print(response.choices[0].message.content)
print(response)


